package class02;

/**
 * 只是讨巧，并不实用，注意外部依赖影响
 */
public class Code07_DeleteNodeWithoutHead {
    public static class ListNode {
        int val;
        ListNode next;

        ListNode() {
        }

        ListNode(int val) {
            this.val = val;
        }

        ListNode(int val, ListNode next) {
            this.val = val;
            this.next = next;
        }
    }

    public static void deleteNode(ListNode node) {

        if (null == node && null == node.next) {
            return;
        }

        node.val = node.next.val;
        node.next = node.next.next;
    }
}